home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 13 - 1997 (partial) / 13.02 Feb 97 / Game Sprockets / SprocketInvaders / Project / Game Sprockets SDK / InputSprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-19  |  19.9 KB  |  817 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    File:            InputSprocket.h
  3.  *
  4.  *    Version:        Apple Game Sprockets 1.0.3 DR 3
  5.  *
  6.  *    Dependencies:    Universal Interfaces 2.1.2 on ETO #20
  7.  *
  8.  *    Contents:        Public interfaces for InputSprocket.
  9.  *
  10.  *    Bugs:            If you find a problem with this file or InputSprocketLib,
  11.  *                    please send e-mail describing the problem in enough detail
  12.  *                    to be reproduced, and include the version number above, the
  13.  *                    version of MacOS and hardware configuration information to
  14.  *                    sprockets@adr.apple.com.
  15.  *
  16.  *    Copyright (c) 1996 Apple Computer, Inc.  All rights reserved.
  17.  */
  18.  
  19. #ifndef __INPUTSPROCKET__
  20. #define __INPUTSPROCKET__
  21.  
  22.  
  23. #ifndef __TYPES__
  24. #include <Types.h>
  25. #endif
  26. /*    #include <ConditionalMacros.h>                                */
  27.  
  28. #ifndef __EVENTS__
  29. #include <Events.h>
  30. #endif
  31.  
  32.  
  33. #if GENERATINGPOWERPC
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=power
  41. #endif
  42.  
  43. /****** YOU NEED THESE LINES IF YOU DON'T HAVE THE LATEST TYPES.h
  44.  
  45. struct UnsignedWide {
  46.     UInt32                            hi;
  47.     UInt32                            lo;
  48. };
  49.  
  50. typedef UnsignedWide AbsoluteTime;
  51.  
  52. */
  53.  
  54. /* ********************* data types ********************* */
  55. typedef struct ISpDevicePrivate *ISpDeviceReference;
  56. typedef struct ISpElementPrivate *ISpElementReference;
  57. typedef struct ISpElementListPrivate *ISpElementListReference;
  58. typedef OSType ISpDeviceClass;  /* general classs of device, example : keyboard, mouse, joystick */
  59. typedef OSType ISpDeviceIdentifier;   /* a specific device,  example: standard 1-button mouse, 105key ext. kbd. */
  60. typedef OSType ISpElementLabel;
  61. typedef OSType ISpElementKind;
  62.  
  63. /* *************** errors -30420 to -30439***************** */
  64.  
  65. enum
  66. {
  67.     kISpInternalErr = -30420,
  68.     kISpSystemListErr = -30421,
  69.     kISpBufferToSmallErr = -30422,
  70.     kISpElementInListErr = -30423,
  71.     kISpElementNotInListErr = - 30424,
  72.     kISpSystemInactiveErr = -30425,
  73.     kISpDeviceInactiveErr = -30426,
  74.     kISpSystemActiveErr = -30427,
  75.     kISpDeviceActiveErr = -30428,
  76.     kISpListBusyErr = -30429
  77. };
  78.  
  79. /* *************** resources **************** */
  80.  
  81. enum 
  82. {
  83.     kISpSetListResourceType = 'setl',
  84.     kISpSetDataResourceType = 'setd'
  85. };
  86.  
  87. /*
  88.  * ISpDeviceDefinition
  89.  *
  90.  * This structure provides all the available
  91.  * information for an input device within the system
  92.  *
  93.  */
  94.  
  95. typedef struct ISpDeviceDefinition
  96. {
  97.     Str63 deviceName;                /* a human readable name of the device */
  98.     ISpDeviceClass theDeviceClass;        /* general classs of device example : keyboard, mouse, joystick */
  99.     ISpDeviceIdentifier theDeviceIdentifier;        /* every distinguishable device should have an OSType */
  100.     UInt32 permanentID;            /* a cross reboot id unique within that deviceType, 0 if not possible */
  101.     UInt32 flags;                /* some status flags */
  102.     UInt32 reserved1;
  103.     UInt32 reserved2;
  104.     UInt32 reserved3;
  105. } ISpDeviceDefinition;
  106.  
  107. enum
  108. {
  109.     kISpDeviceFlag_HandleOwnEmulation = 1
  110. };
  111.  
  112. /*
  113.  * ISpElementEvent, ISpElementEventPtr
  114.  *
  115.  * This is the structure that event data is passed in.
  116.  *
  117.  */
  118.  
  119. typedef struct ISpElementEvent
  120. {
  121.     AbsoluteTime when;                  /* this is absolute time on PCI or later, otherwise it is */
  122.                                         /* 0 for the hi 32 bits and TickCount for the low 32 bits */
  123.     ISpElementReference element;        /* a reference to the element that generated this event */
  124.     UInt32 refCon;                        /* for application usage, 0 on the global list */
  125.     UInt32 data;                        /* the data for this event */
  126. } ISpElementEvent, *ISpElementEventPtr;
  127.  
  128. /*
  129.  * ISpElementInfo, ISpElementInfoPtr
  130.  *
  131.  * This is the generic definition of an element.
  132.  * Every element must contain this information.
  133.  *
  134.  */
  135. typedef struct ISpElementInfo
  136. {
  137.     ISpElementLabel theLabel;
  138.     ISpElementKind theKind;
  139.     Str63 theString;
  140.     UInt32 reserved1;
  141.     UInt32 reserved2;
  142. } ISpElementInfo, *ISpElementInfoPtr;
  143.  
  144. typedef struct ISpNeed
  145. {
  146.     Str63 name;
  147.     short iconSuiteResourceId;    /* resource id of the icon suite */
  148.     short reserved;
  149.     ISpElementKind theKind;
  150.     ISpElementLabel theLabel;
  151.     UInt32 flags;
  152.     UInt32 reserved1;
  153.     UInt32 reserved2;
  154.     UInt32 reserved3;
  155. } ISpNeed;
  156.  
  157. typedef UInt32 ISpNeedFlagBits;
  158. enum
  159. {
  160.     kISpNeedFlag_NoMultiConfig = 1
  161. };
  162.  
  163. /*
  164.  *
  165.  * These are the current built values for ISpDeviceClass
  166.  *
  167.  */
  168.  
  169. enum
  170. {
  171.     kISpDeviceClass_SpeechRecognition = 'talk',
  172.     kISpDeviceClass_Mouse = 'mous',
  173.     kISpDeviceClass_Keyboard = 'keyd',
  174.     kISpDeviceClass_Joystick = 'joys',
  175.     kISpDeviceClass_Wheel = 'whel',
  176.     kISpDeviceClass_Pedals = 'pedl',
  177.     kISpDeviceClass_Levers = 'levr',
  178.     kISpDeviceClass_Poll = 'poll'        // a device of this class requires ISpPoll
  179. };
  180.  
  181. /*
  182.  * These are the current built in ISpElementKind's
  183.  * 
  184.  * These are all OSTypes.
  185.  *
  186.  */
  187.  
  188. enum
  189. {
  190.     kISpElementKind_Button = 'butn',
  191.     kISpElementKind_DPad = 'dpad',
  192.     kISpElementKind_Axis = 'axis',
  193.     kISpElementKind_Movement = 'move',
  194.     kISpElementKind_Virtual = 'virt'
  195. };
  196.  
  197.  
  198. /*
  199.  *
  200.  * These are the current built in ISpElementLabel's
  201.  *
  202.  * These are all OSTypes.
  203.  *
  204.  */
  205.  
  206. #ifndef DONT_USE_OLD_INPUT_SPROCKET_LABELS 
  207. enum
  208. {
  209.     /* axis */
  210.     kISpElementLabel_XAxis = 'xaxi',
  211.     kISpElementLabel_YAxis = 'yaxi',
  212.     kISpElementLabel_ZAxis = 'zaxi',
  213.     
  214.     kISpElementLabel_Rx = 'rxax',
  215.     kISpElementLabel_Ry = 'ryax',
  216.     kISpElementLabel_Rz = 'rzax',
  217.     
  218.     kISpElementLabel_Gas = 'gasp',
  219.     kISpElementLabel_Brake = 'brak',
  220.     kISpElementLabel_Clutch = 'cltc',
  221.     
  222.     kISpElementLabel_Throttle = 'thrt',
  223.     kISpElementLabel_Trim = 'trim',
  224.     
  225.     /* direction pad */
  226.     kISpElementLabel_POVHat = 'povh',
  227.     kISpElementLabel_PadMove = 'move',
  228.     
  229.     /* buttons */
  230.     kISpElementLabel_Fire = 'fire',
  231.     kISpElementLabel_Start = 'strt',
  232.     kISpElementLabel_Select = 'optn'
  233. };
  234. #endif
  235.  
  236. enum
  237. {
  238.     /* generic */
  239.     kISpElementLabel_None = 'none',
  240.     
  241.     /* axis */
  242.     kISpElementLabel_Axis_XAxis = 'xaxi',
  243.     kISpElementLabel_Axis_YAxis = 'yaxi',
  244.     kISpElementLabel_Axis_ZAxis = 'zaxi',
  245.     
  246.     kISpElementLabel_Axis_Rx = 'rxax',
  247.     kISpElementLabel_Axis_Ry = 'ryax',
  248.     kISpElementLabel_Axis_Rz = 'rzax',
  249.     
  250.     kISpElementLabel_Axis_Gas = 'gasp',
  251.     kISpElementLabel_Axis_Brake = 'brak',
  252.     kISpElementLabel_Axis_Clutch = 'cltc',
  253.     
  254.     kISpElementLabel_Axis_Throttle = 'thrt',
  255.     kISpElementLabel_Axis_Trim = 'trim',
  256.     kISpElementLabel_Axis_Rudder = 'rudd',
  257.     
  258.     /* direction pad */
  259.     kISpElementLabel_Pad_POV = 'povh',
  260.     kISpElementLabel_Pad_Move = 'move',
  261.     
  262.     /* buttons */
  263.     kISpElementLabel_Btn_Fire = 'fire',
  264.     kISpElementLabel_Btn_SecondaryFire = 'sfir',
  265.     kISpElementLabel_Btn_Jump = 'jump',
  266.     kISpElementLabel_Btn_PauseResume = 'strt',    
  267.     /* kISpElementLabel_Btn_PauseResume automatically binds to escape */
  268.     kISpElementLabel_Btn_Select = 'optn',
  269.     
  270.     kISpElementLabel_Btn_SlideLeft = 'blft',
  271.     kISpElementLabel_Btn_SlideRight = 'brgt',
  272.     
  273.     kISpElementLabel_Btn_MoveForward = 'btmf',
  274.     kISpElementLabel_Btn_MoveBackward = 'btmb',
  275.     
  276.     kISpElementLabel_Btn_TurnLeft = 'bttl',
  277.     kISpElementLabel_Btn_TurnRight = 'bttr',
  278.     
  279.     kISpElementLabel_Btn_LookLeft = 'btll',
  280.     kISpElementLabel_Btn_LookRight = 'btlr',
  281.     kISpElementLabel_Btn_LookUp = 'btlu',
  282.     kISpElementLabel_Btn_LookDown = 'btld',
  283.     
  284.     kISpElementLabel_Btn_Next = 'btnx',
  285.     kISpElementLabel_Btn_Previous = 'btpv',
  286.     
  287.     kISpElementLabel_Btn_SideStep = 'side',
  288.     kISpElementLabel_Btn_Run = 'quik',
  289.     kISpElementLabel_Btn_Look = 'blok'
  290. };
  291.  
  292. /*
  293.  *
  294.  * direction pad data & configuration information
  295.  *
  296.  */
  297.  
  298. typedef UInt32 ISpDPadData;
  299. enum
  300. {
  301.     kISpPadIdle = 0,
  302.     kISpPadLeft,
  303.     kISpPadUpLeft,
  304.     kISpPadUp,
  305.     kISpPadUpRight,
  306.     kISpPadRight,
  307.     kISpPadDownRight,
  308.     kISpPadDown,
  309.     kISpPadDownLeft
  310. };
  311.  
  312. typedef struct ISpDPadConfigurationInfo
  313. {
  314.     UInt32 id;                /* ordering 1..n, 0 = no relavent ordering of direction pads */
  315.     Boolean fourWayPad;        /* true if this pad can only produce idle + four directions */
  316. } ISpDPadConfigurationInfo;
  317.  
  318. /*
  319.  *
  320.  * button data & configuration information
  321.  *
  322.  */
  323.  
  324. typedef UInt32 ISpButtonData;
  325. enum
  326. {
  327.     kISpButtonUp = 0,
  328.     kISpButtonDown = 1
  329. };
  330.  
  331. typedef struct ISpButtonConfigurationInfo
  332. {
  333.     UInt32 id;                /* ordering 1..n, 0 = no relavent ordering of buttons */
  334. } ISpButtonConfigurationInfo;
  335.  
  336. /*
  337.  *
  338.  * axis data & configuration information 
  339.  *
  340.  */
  341.  
  342. #define    kISpAxisMinimum  0x00000000U
  343. #define    kISpAxisMiddle   0x7FFFFFFFU
  344. #define    kISpAxisMaximum  0xFFFFFFFFU
  345.  
  346. typedef struct ISpAxisConfigurationInfo
  347. {
  348.     Boolean    symetricAxis;    /* axis is symetric, i.e. meaningful 0ish idle at the kISpAxisMiddle position */
  349. } ISpAxisConfigurationInfo;
  350.  
  351.  
  352. typedef struct ISpMovementData
  353. {
  354.     UInt32 xAxis;
  355.     UInt32 yAxis;
  356.     UInt32 direction;    /* ISpDPadData version of the movement */
  357. } ISpMovementData;
  358.  
  359. enum
  360. {
  361.     kISpVirtualElementFlag_UseTempMem = 1
  362. };
  363.  
  364. enum
  365. {
  366.     kISpElementListFlag_UseTempMem = 1
  367. };
  368.  
  369. enum
  370. {
  371.     kISpFirstIconSuite = 30000,
  372.     kISpLastIconSuite = 30100,
  373.     kISpNoneIconSuite = 30000
  374. };
  375.  
  376. /* ********************* user level functions ********************* */
  377.  
  378.  
  379.  
  380. /*
  381.  *
  382.  * startup / shutdown
  383.  *
  384.  */
  385.  
  386. OSStatus ISpStartup(void);    // 1.03 or later
  387. OSStatus ISpShutdown(void);
  388.  
  389. /*
  390.  *
  391.  * polling
  392.  *
  393.  */
  394.  
  395.  OSStatus ISpTickle(void);    // 1.03 or later
  396.  
  397. /********** user interface functions **********/
  398.  
  399.  
  400. NumVersion ISpGetVersion(void);
  401.  
  402. /*
  403.  *
  404.  * ISpElement_NewVirtual(ISpElementReference *outElement);
  405.  *
  406.  */
  407.  
  408. OSStatus ISpElement_NewVirtual(UInt32 dataSize, ISpElementReference *outElement, UInt32 flags);
  409.  
  410. /*
  411.  *
  412.  * ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeeds *needs, ISpElementReference *outElements);
  413.  *
  414.  */
  415.  
  416. OSStatus ISpElement_NewVirtualFromNeeds(UInt32 count, ISpNeed *needs, ISpElementReference *outElements, UInt32 flags);
  417.  
  418. /*
  419.  *
  420.  * ISpElement_DisposeVirtual(inElement);
  421.  *
  422.  */
  423.  
  424. OSStatus ISpElement_DisposeVirtual(UInt32 count, ISpElementReference *inElements);
  425.  
  426. /*
  427.  * ISpInit
  428.  *
  429.  */
  430.  
  431. OSStatus ISpInit(
  432.     UInt32 count,
  433.     ISpNeed *needs,
  434.     ISpElementReference *inReferences,
  435.     OSType appCreatorCode,
  436.     OSType subCreatorCode,
  437.     UInt32 flags,
  438.     short setListResourceId, 
  439.     UInt32 version);
  440.     
  441.     
  442. /*
  443.  * ISpConfigure
  444.  *
  445.  */
  446.  
  447. typedef Boolean (*ISpEventProcPtr) (EventRecord* inEvent);
  448.  
  449. OSStatus ISpConfigure(ISpEventProcPtr inEventProcPtr);
  450.  
  451. /*
  452.  *
  453.  * ISpStop
  454.  *
  455.  */
  456.  
  457. OSStatus ISpStop(void);
  458.  
  459. /*
  460.  *
  461.  * ISpSuspend, ISpResume
  462.  *
  463.  */
  464.  
  465. OSStatus ISpSuspend(void);
  466. OSStatus ISpResume(void);
  467.  
  468. /*
  469.  * DevicesExtract
  470.  *
  471.  * DevicesExract will extract as many of the devices from a system wide list as possible.  You pass
  472.  * ina pointer to an array of device references and the size of that array in units of sizeof(ISpDeviceReference)
  473.  * It will return how many device references are in the system wide list in the outCount parameter and 
  474.  * it will copy the minimum of that number and the size of the inBufferCount parameter (how big your array was).
  475.  *
  476.  * ByClass and ByIdentifier are the same except that they will only count and copy device references to devices
  477.  * of the specified class or identifier.
  478.  *
  479.  * Return Codes
  480.  * paramErr
  481.  *
  482.  */
  483.  
  484. OSStatus ISpDevices_Extract(UInt32 inBufferCount, UInt32 *outCount, ISpDeviceReference *buffer);
  485. OSStatus ISpDevices_ExtractByClass(ISpDeviceClass theClass, UInt32 inBufferCount, UInt32 *outCount, ISpDeviceReference *buffer);
  486. OSStatus ISpDevices_ExtractByIdentifier(ISpDeviceIdentifier theIdentifier, UInt32 inBufferCount, UInt32 *outCount, ISpDeviceReference *buffer);
  487.  
  488.  
  489. /*
  490.  * DeactivateDevices, ActivateDevices
  491.  *
  492.  * All devices in the sytem start out activate but if for some reason you don't want to get events
  493.  * from some devices then you can use these class to turn on and off getting those events.  The 
  494.  * most likely case is if you would want to get input from the keyboard or mouse as cursor/text style
  495.  * data.
  496.  *
  497.  * Return Codes
  498.  * paramErr
  499.  *
  500.  */
  501.  
  502. OSStatus ISpDevices_ActivateClass(ISpDeviceClass theClass);        // 1.03 or only
  503. OSStatus ISpDevices_DeactivateClass(ISpDeviceClass theClass);    // 1.03 or only
  504. OSStatus ISpDevices_Activate(UInt32 inDeviceCount, ISpDeviceReference *inDevicesToActivate);
  505. OSStatus ISpDevices_Deactivate(UInt32 inDeviceCount, ISpDeviceReference *inDevicesToDeactivate);
  506. OSStatus ISpDevice_IsActive(ISpDeviceReference inDevice, Boolean *outIsActive);
  507.  
  508. /*
  509.  * ISpDevice_GetDefinition
  510.  *
  511.  * pass in the device reference, sizeof(ISpDeviceDefinition) and this will 
  512.  * return the device definition struct for that device into the buffer pointed to 
  513.  * by outStruct
  514.  *
  515.  * Return Codes
  516.  * paramErr
  517.  *
  518.  */
  519.  
  520. OSStatus ISpDevice_GetDefinition(const ISpDeviceReference inDevice, UInt32 buflen, ISpDeviceDefinition *outStruct);
  521.  
  522.  
  523. /*
  524.  *
  525.  * ISpDevice_GetElementList
  526.  *
  527.  * pass in the device reference and this will return the element list for that device
  528.  * you are prohibited from modifiying this element list 
  529.  *
  530.  * Return Codes
  531.  * paramErr
  532.  *
  533.  */
  534.  
  535. OSStatus ISpDevice_GetElementList(const ISpDeviceReference inDevice, ISpElementListReference *outElementList);
  536.  
  537. /*
  538.  *
  539.  * takes an ISpElementReference and returns the group that it is in or 0 if there is
  540.  * no group
  541.  *
  542.  * Return Codes
  543.  * paramErr if inElement is 0
  544.  *
  545.  */
  546.  
  547. OSStatus ISpElement_GetGroup(const ISpElementReference inElement, UInt32 *outGroup);
  548.  
  549. /*
  550.  *
  551.  * takes an ISpElementReference and returns the device that the element belongs 
  552.  * to.
  553.  *
  554.  * Return Codes
  555.  * paramErr if inElement is 0 or outDevice is nil
  556.  *
  557.  */
  558.  
  559. OSStatus ISpElement_GetDevice(const ISpElementReference inElement, ISpDeviceReference *outDevice);
  560.         
  561. /*
  562.  *
  563.  * takes an ISpElementReference and gives the ISpElementInfo for that Element.  This is the
  564.  * the set of standard information.  You get ISpElementKind specific information
  565.  * through ISpElement_GetConfigurationInfo.
  566.  *
  567.  * Return Codes
  568.  * paramErr if inElement is 0 or outInfo is nil
  569.  *
  570.  */
  571.  
  572. OSStatus ISpElement_GetInfo(const ISpElementReference inElement, ISpElementInfoPtr outInfo);
  573.         
  574. /*
  575.  *
  576.  *         
  577.  *
  578.  * takes an ISpElementReference and gives the ISpElementKind specific configuration information
  579.  * 
  580.  * if buflen is not long enough to hold the information ISpElement_GetConfigurationInfo will
  581.  * copy buflen bytes of the data into the block of memory pointed to by configInfo and
  582.  * will return something error.
  583.  *
  584.  * Return Codes
  585.  * paramErr if inElement or configInfo is nil
  586.  * something error if buflen is not long enough to hold the information
  587.  *
  588.  */
  589.  
  590. OSStatus ISpElement_GetConfigurationInfo(const ISpElementReference inElement, UInt32 buflen, void *configInfo);
  591.     
  592. /*
  593.  *
  594.  * ISpElement_GetSimpleState
  595.  *
  596.  * Takes an ISpElementReference and returns the current state of that element.  This is a 
  597.  * specialized version of ISpElement_GetComplexState that is only appropriate for elements
  598.  * whose data fits in a signed 32 bit integer.
  599.  *
  600.  *
  601.  *
  602.  * Return Codes
  603.  * paramErr if inElement is 0 or state is nil
  604.  * err1 if the elements data does not fit in a signed 32 bit integer
  605.  *
  606.  */
  607.  
  608. OSStatus ISpElement_GetSimpleState(const ISpElementReference inElement, UInt32 *state);
  609.  
  610. /*
  611.  *
  612.  * ISpElement_GetComplexState
  613.  *
  614.  * Takes an ISpElementReference and returns the current state of that element.  
  615.  * Will copy up to buflen bytes of the current state of the device into
  616.  * state.
  617.  *
  618.  *
  619.  * Return Codes
  620.  * paramErr if inElement is 0 or state is nil
  621.  * err2 if buflen is not large enough to hold all the data
  622.  *
  623.  */
  624.  
  625. OSStatus ISpElement_GetComplexState(const ISpElementReference inElement, UInt32 buflen, void *state);
  626.  
  627.  
  628. /*
  629.  * ISpElement_GetNextEvent
  630.  *
  631.  * changed 3/14/96
  632.  *
  633.  * It takes in an element  reference and the buffer size of the ISpElementEventPtr
  634.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  635.  * was not enough space to fill in the whole event structure that event will be
  636.  * dequed, as much of the event as will fit in the buffer will by copied and
  637.  * ISpElement_GetNextEvent will return an error.
  638.  *
  639.  * Return Codes
  640.  * paramErr
  641.  * somethingErr - buffer to small
  642.  */
  643.  
  644. OSStatus ISpElement_GetNextEvent(ISpElementReference inElement, UInt32 bufSize, ISpElementEventPtr event, Boolean *wasEvent);
  645.  
  646. /*
  647.  *
  648.  * ISpElement_Flush
  649.  *
  650.  * It takes an ISpElementReference and flushes all the events on that element.  All it guaruntees is
  651.  * that any events that made it to this layer before the time of the flush call will be flushed and
  652.  * it will not flush any events that make it to this layer after the time when the call has returned.
  653.  * What happens to events that occur during the flush is undefined.
  654.  *
  655.  *
  656.  * Return Codes
  657.  * paramErr
  658.  *
  659.  */
  660.  
  661. OSStatus ISpElement_Flush(ISpElementReference inElement);
  662.  
  663.  
  664.  
  665. /*
  666.  * ISpElementList_New
  667.  *
  668.  * Creates a new element list and returns it in outElementList.  In count specifies 
  669.  * the number of element references in the list pointed to by inElements.  If inCount
  670.  * is non zero the list is created with inCount elements in at as specified by the 
  671.  * inElements parameter.  Otherwise the list is created empty.
  672.  *
  673.  *
  674.  * Return Codes
  675.  * out of memory - If it failed to allocate the list because it was out of memory
  676.                    it will also set outElementList to 0
  677.  * paramErr if outElementList was nil
  678.  *
  679.  *
  680.  * Special Concerns
  681.  *
  682.  * interrupt unsafe
  683.  *
  684.  */
  685.  
  686. OSStatus ISpElementList_New(UInt32 inCount, ISpElementReference *inElements, ISpElementListReference *outElementList, UInt32 flags);
  687.  
  688. /*
  689.  * ISpElementList_Dispose
  690.  *
  691.  * Deletes an already existing memory list.  
  692.  *
  693.  *
  694.  * Return Codes
  695.  * paramErr if inElementList was 0
  696.  *
  697.  *
  698.  * Special Concerns
  699.  *
  700.  * interrupt unsafe
  701.  *
  702.  */
  703.  
  704. OSStatus ISpElementList_Dispose(ISpElementListReference inElementList);
  705.  
  706. /*
  707.  * ISpGetGlobalElementList
  708.  *
  709.  * returns the global element list
  710.  *
  711.  * Return Codes
  712.  * paramErr if outElementList is nil
  713.  *
  714.  */ 
  715.  
  716. OSStatus ISpGetGlobalElementList(ISpElementListReference *outElementList);
  717.  
  718. /*
  719.  * ISpElementList_AddElement
  720.  *
  721.  * adds an element to the element list
  722.  *
  723.  * Return Codes
  724.  * paramErr if inElementList is 0 or newElement is 0
  725.  * memory error if the system is unable to allocate enough memory
  726.  *
  727.  * Special Concerns
  728.  * interrupt Unsafe
  729.  * 
  730.  */
  731. OSStatus ISpElementList_AddElements(ISpElementListReference inElementList, UInt32 refCon, UInt32 count, ISpElementReference *newElements);
  732.  
  733. /*
  734.  * ISpElementList_RemoveElement
  735.  *
  736.  * removes the specified element from the element list
  737.  *
  738.  * Return Codes
  739.  * paramErr if inElementList is 0 or oldElement is 0
  740.  * memory error if the system is unable to allocate enough memory
  741.  *
  742.  * Special Concerns
  743.  * interrupt Unsafe
  744.  * 
  745.  */
  746.  
  747. OSStatus ISpElementList_RemoveElements(ISpElementListReference inElementList, UInt32 count, ISpElementReference *oldElement);
  748.  
  749. /*
  750.  * ISpElementList_Extract
  751.  *
  752.  * ISpElementList_Extract will extract as many of the elements from an element list as possible.  You pass
  753.  * in an element list, a pointer to an array of element references and the number of elements in that array.
  754.  * It will return how many items are in the element list in the outCount parameter and copy the minimum of 
  755.  * that number and the size of the array into the buffer.
  756.  *
  757.  * ByKind and ByLabel are the same except that they will only count and copy element references to elements
  758.  * that have the specified kind and label.
  759.  *
  760.  * Return Codes
  761.  * paramErr
  762.  *
  763.  */
  764.  
  765. OSStatus ISpElementList_Extract(ISpElementListReference inElementList, UInt32 inBufferCount, UInt32 *outCount, ISpElementReference *buffer);
  766. OSStatus ISpElementList_ExtractByKind(ISpElementListReference inElementList, ISpElementKind theKind, UInt32 inBufferCount, UInt32 *outCount, ISpElementReference *buffer);
  767. OSStatus ISpElementList_ExtractByLabel(ISpElementListReference inElementList, ISpElementLabel theLabel, UInt32 inBufferCount, UInt32 *outCount, ISpElementReference *buffer);
  768.  
  769. /*
  770.  * ISpElementList_GetNextEvent
  771.  *
  772.  * changed 3/14/96
  773.  *
  774.  * It takes in an element list reference and the buffer size of the ISpElementEventPtr
  775.  * it will set wasEvent to true if there was an event and false otherwise.  If there
  776.  * was not enough space to fill in the whole event structure that event will be
  777.  * dequed, as much of the event as will fit in the buffer will by copied and
  778.  * ISpElementList_GetNextEvent will return an error.
  779.  *
  780.  * Return Codes
  781.  * paramErr
  782.  * somethingErr - buffer to small
  783.  */
  784.  
  785. OSStatus ISpElementList_GetNextEvent(ISpElementListReference inElementList, UInt32 bufSize, ISpElementEventPtr event, Boolean *wasEvent);
  786.  
  787. /*
  788.  *
  789.  * ISpElementList_Flush
  790.  *
  791.  * It takes an ISpElementListReference and flushes all the events on that list.  All it guaruntees is
  792.  * that any events that made it to this layer before the time of the flush call will be flushed and
  793.  * it will not flush any events that make it to this layer after the time when the call has returned.
  794.  * What happens to events that occur during the flush is undefined.
  795.  *
  796.  *
  797.  * Return Codes
  798.  * paramErr
  799.  *
  800.  */
  801.  
  802. OSStatus ISpElementList_Flush(ISpElementListReference inElementList);
  803.  
  804.  
  805. #ifdef __cplusplus
  806. }
  807. #endif
  808.  
  809.  
  810.  
  811. #if PRAGMA_ALIGN_SUPPORTED
  812. #pragma options align=reset
  813. #endif
  814.  
  815. #endif /* GENERATINGPOWERPC */
  816. #endif /* __INPUTSPROCKET__ */
  817.